<html>
<head>
<title>Select Media</title>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Expires" CONTENT="-1">
<cfparam name="f" default="media">
<cfparam name="dir" default="/">
<cfoutput><script type="text/javascript" src="#request.absolutepath#js/tinymce/tiny_mce_popup.js"></script></cfoutput>
<script>tinyMCEPopup.onInit.add(FileBrowserDialogue.init, FileBrowserDialogue);</script>
<cfset p = "#request.basepath##f##dir#">
<!---full path to the folder where the documents are--->
<cfdirectory action="list" directory="#p#" name="qfiles" type="file" listinfo="name" sort="name ACS">
<!---set number per column--->
<cfset percol = qfiles.recordcount / 3>
<cfset percol = round(percol)>
<cfset end1 = 0 + percol>
<cfset end2 = end1 + percol>
<cfset end3 = end2 + percol>
<!---<cfset end4 = end3 + percol>--->
<cfset start2 = end1 + 1>
<cfset start3 = end2 + 1>
<!---<cfset start4 = end3 + 1>--->
<style>
body { background: none; }
</style>
<body style="margin: 4px;">
<h2>Select Media</h2>
<cfif qfiles.recordcount IS 0>
	You have no media files uploaded to your website
</cfif>
<cfoutput>
<table width="100%" cellpadding="0" cellspacing="0">
  <cfloop query="qfiles">
  <tr class="menu_row" onMouseOver="this.className = 'menu_row_over2';" onMouseOut="this.className = 'menu_row';">
    <td class="menu_cell"><cfset idname=replacenocase(name, ".cfm", "")>
      <div id="filename_row"> <span class="filename" onClick="FileBrowserDialogue.getlink('#request.absolutepath##f##dir##name#');" id = "norename_#idname#" style="display: block; white-space: nowrap;"> <img src = "#request.absoluteadminpath#images/document.png" align="absmiddle" />&nbsp;#name# </span> </span> <span id="actions"> </span> </div></td>
  </tr>
  </cfloop>
</table>
</cfoutput>
</body>
</html>
